﻿using System;
using System.Collections.Generic;
using System.Linq;
using BusinessObjects.Base;

namespace BusinessObjects.Logic.Base {
    public class XMLData {
        public string Type { get; set; }
        public string FileName { get; set; }
        public string FileData { get; set; }
    }

    public class LogicBase : UnitOfWork, ILogic  {
        protected LogicBase() { }
        protected LogicBase(Datalayer.Databases Database) : base(Database) { }

        public new void Delete(IEnumerable<IEntity> Objects) {
            this.AddDeleteObjects(Objects);
        }

        public void Insert<T>(string XML) where T : IEntity, new() {
            this.AddInsertXML<T>(XML);
        }

        public new void Insert(IEnumerable<IEntity> Objects) {
            this.AddInsertObjects(Objects);
        }

        public new void Update(IEnumerable<IEntity> Objects) {
            this.AddUpdateObjects(Objects);
        }

        public IEnumerable<XMLData> SelectObjects<T>() where T : IEntity, new() {
          return this.GetXML<T>();
        }

        public void Commit() {
            this.CommitUnitOfWork();
        }
    }
}
